{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "099abd32-6c57-4b26-85fb-e86ab4df8aeb",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "变换前,s= [9, 7, 8, 3, 2, 1, 5, 6]\n",
      "变换后,s= [9, 7, 64, 3, 4, 1, 5, 36]\n"
     ]
    }
   ],
   "source": [
    "s=[9,7,8,3,2,1,5,6]\n",
    "print( \"变换前,s=\", s) #原列表内容\n",
    "for i in range( 0,  len(s)):\n",
    "    if (s[i] % 2) ==0:   #如果第i个元素是偶数\n",
    "        s[i] = s[i] * s[i]\n",
    "print( \"变换后,s=\",s)\n",
    "  \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "060ca5d9-3b36-489e-a976-e122e5c66c86",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
